package com.tyrone.gateway.route.bean;

import com.tyrone.gateway.handler.Handler;
import com.tyrone.gateway.registry.LoadBalanceEnum;
import com.tyrone.gateway.registry.ServiceInfo;
import lombok.Data;
import org.apache.logging.log4j.core.config.Order;

import java.util.List;
import java.util.Locale;

/**
 * 路由信息
 */
@Data
public class RouteInfo {
    private Long id;  //路由id
    //    private Integer order; //优先级  数值越大却优先 当优先级高的无法调用的时候，调用优先级低的
    private String rawPath; // 匹配路径
    private String serviceName; //upstream服务名

    private Integer loadBalanceType;

    private List<Handler> handlers; // 路由处理器

    public ServiceInfo convertToServiceInfo() {
        ServiceInfo serviceInfo = new ServiceInfo();
        serviceInfo.setName(this.serviceName);
        return serviceInfo;
    }

}
